﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BookClubIt.DTO;
using BookClubIt.Data;

namespace BookClubIt.Processor
{
    public class BookClubProcessor
    {
        BookClubData bookClubDataInstance;
        public BookClubData BookClubDataInstance
        {
            get
            {
                if (bookClubDataInstance == null) bookClubDataInstance = new BookClubData();
                return bookClubDataInstance;
            }
        }

        public BookClub SaveBookClub(BookClub bookclub)
        {
            return BookClubDataInstance.SaveBookClub(bookclub);
        }

        public Meeting SaveMeeting(Meeting meeting)
        {
            return BookClubDataInstance.SaveMeeting(meeting);
        }
        public Meetings GetMeetings(int cid)
        {
            return BookClubDataInstance.GetMeetings(cid);
        }

        public Meeting GetMeetingById(int mid)
        {
            return BookClubDataInstance.GetMeetingById(mid);
        }

        public BookClub CreateTopic(int bid, int bookid, string topic, string asin)
        {
            return BookClubDataInstance.CreateTopic(bid, bookid, topic, asin);
        }
        public Topics GetDiscussionTopics(int bid, bool current)
        {
            return BookClubDataInstance.GetDiscussionTopics(bid, current);
        }

        public Comments GetTopicComments(int tid)
        {
            return BookClubDataInstance.GetTopicComments(tid);
        }

        public Activities GetActivityById(int cid)
        {
            return BookClubDataInstance.GetActivityById(cid);
        }
        public Activities GetTopActivityById(int cid)
        {
            return BookClubDataInstance.GetTopActivityById(cid);
        }

        public Comment GetLatestComment(int tid)
        {
            return BookClubDataInstance.GetLatestComment(tid);
        }

        public Topic GetDiscussionTopic(int bid, int tid)
        {
            return BookClubDataInstance.GetDiscussionTopic(bid, tid);
        }

        public BookClubs GetMemberBookClubs(int uid)
        {
            return BookClubDataInstance.GetMemberBookClubs(uid);
        }
        public BookClubs GetBookClubsByBookReading(int bid)
        {
            return BookClubDataInstance.GetBookClubsByBookReading(bid);
        }

        public Topic GetDiscussionTopicById(int tid)
        {
            return BookClubDataInstance.GetDiscussionTopicById(tid);
        }

        public int CreateTopicComment(int tid, int uid, string comment)
        {
            return BookClubDataInstance.CreateTopicComment(tid, uid, comment);
        }

        public void DeleteTopicComment(int tid)
        {
            BookClubDataInstance.DeleteTopicComment(tid);
        }

        public BookClubs GetActiveBookClubs()
        {
            return BookClubDataInstance.GetActiveBookClubs();
        }
        public BookClubs SearchBookClubsByTitle(string title)
        {
            return BookClubDataInstance.SearchBookClubsByTitle(title);
        }
        public BookClubs GetTopBookClubs()
        {
            return BookClubDataInstance.GetTopBookClubs();
        }
        public BookClubs GetPopularBookClubs()
        {
            return BookClubDataInstance.GetPopularBookClubs();
        }
        public BookClubs GetBookClubsByGenre(int gid)
        {
            return BookClubDataInstance.GetBookClubsByGenre(gid);
        }
        public BookClub GetBookClubById(int bid)
        {
            return BookClubDataInstance.GetBookClubById(bid, true);
        }
        //public BookClub GetBookClubTypeById(int bid)
        //{
        //    return BookDataInstance.GetBookClubTypeById(bid);
        //}
        public ClubType GetBookClubType(int ctid)
        {
            return BookClubDataInstance.GetBookClubType(ctid);
        }
        public GenreType GetBookClubGenre(int gtid)
        {
            return BookClubDataInstance.GetBookClubGenre(gtid);
        }
        public void ChangeBookInClubById(int cid, int bid)
        {
            BookClubDataInstance.ChangeBookInClubById(cid, bid);
        }
        public void DeleteBookClub(int cid)
        {
            BookClubDataInstance.DeleteBookClub(cid);
        }
        public void AddBookToClubShelf(int cid, int bid)
        {
            BookClubDataInstance.AddBookToClubShelf(cid, bid);
        }
        public void RemoveBookFromClubShelf(int cid, int bid)
        {
            BookClubDataInstance.RemoveBookFromClubShelf(cid, bid);
        }
        public BookClub UpdateBookClubAvatar(int cid, string filename)
        {
            return BookClubDataInstance.UpdateBookClubAvatar(cid, filename);
        }
        public BookClub JoinBookClub(int cid, int uid, bool approved)
        {
            return BookClubDataInstance.JoinBookClub(cid, uid,approved);
        }
        public BookClub AddLeaderToClub(int bid, int uid)
        {
            return BookClubDataInstance.AddLeaderToClub(bid, uid);
        }
        public BookClub AddAdminToClub(int cid, int uid)
        {
            return BookClubDataInstance.AddAdminToClub(cid, uid);
        }
        public BookClub RemoveMemberFromClub(int cid, int uid)
        {
            return BookClubDataInstance.RemoveMemberFromClub(cid, uid);
        }
        public BookClub RemoveLeaderFromClub(int cid, int uid)
        {
            return BookClubDataInstance.RemoveLeaderFromClub(cid, uid);
        }
        public BookClub LeaveBookClub(int bid, int uid)
        {
            return BookClubDataInstance.LeaveBookClub(bid, uid);
        }
        public BookClub GetClubTypes()
        {
            return BookClubDataInstance.GetClubTypes();
        }
        public GenreTypes GetGenreTypes()
        {
            return BookClubDataInstance.GetGenreTypes();
        }
        //public BookClub SaveBookClub()
        //{
        //    return BookDataInstance.SaveBookClub(Id,Name,GenreType,CreatedDate,Description,Rules,ReferenceId,Website,NonLeaderAddEvents,NonLeaderAddPolls,NonLeaderAddTopics,GroupMeetsRealLife);
        //}

        public bool IsLeader(int uid, int bid)
        {
            return BookClubDataInstance.IsLeader(uid, bid);
        }
        public bool IsAdmin(int uid, int cid)
        {
            return BookClubDataInstance.IsAdmin(uid, cid);
        }
        public bool IsBookClubMember(int uid, int cid)
        {
            return BookClubDataInstance.IsBookClubMember(uid, cid);
        }
         public bool IsPendingBookClubMember(int uid, int cid)
        {
            return BookClubDataInstance.IsPendingBookClubMember(uid, cid);
        }
         public void ApprovePendingMember(int cid, int uid)
         {
             BookClubDataInstance.ApprovePendingMember(cid, uid);
         }
         public void DenyPendingMember(int cid, int uid)
         {
             BookClubDataInstance.DenyPendingMember(cid, uid);
         }
         public void SendBookClubMessage(int cid, int senderuid, int recieveruid, string message)
         {
             BookClubDataInstance.SendBookClubMessage(cid, senderuid,recieveruid,message);
         }
        public void AddClubActivity(int cid, int uid, string type,int data)
        {
            BookClubDataInstance.AddClubActivity(cid,uid,type,data);
        }
      
    }
}
